<template>
    <div>
        <div class="search w">
            <div class="top">
                <div class="logo">
                    <img src="../assets/icon/search/logo1.png" alt="">
                    <h1>北极熊</h1>
                </div>
                <div class="input">
                    <form action="">
                        <input type="text" name="itemName" placeholder="搜一个商品，开始立即申请吧！">
                        <button type="submit">搜索</button>
                    </form>
                </div>
            </div>
            <div class="bottom clearfix">
                <div class="categories">全部分类 <img src="../assets/icon/search/all_category.png" alt=""></div>
                <ul class="cate_nav">
                    <li v-for="(item, index) in navItem">
                        <img v-if="item.iconSrc" :src="item.iconSrc" alt=""/>
                        {{item.title}}
                    </li>
                </ul>
            </div>
        </div>
        <div class="fixed" v-if="isNavFixedShow">
            <div class="w">
                <ul>
                    <li class="item active">
                        全部分类
                    </li>
                    <li class="item" v-for="(item,index) in navItem">
                        {{item.title}}
                    </li>
                </ul>
            </div>
        </div>
    </div>

</template>

<script>
    export default {
        name: "Search",
        props: {
            isNavFixedShow: {
                type: Boolean,
                default: false
            }
        },
        data() {
            return {
                navItem: [{
                    title: "首页",
                    topShow: false,
                    iconSrc: ""
                },{
                    title: "好货精选",
                    topShow: true,
                    iconSrc: ""
                },{
                    title: "新人专享",
                    topShow: true,
                    iconSrc: ""
                },{
                    title: "拼团开奖",
                    topShow: false,
                    iconSrc: ""
                },{
                    title: "金币必中",
                    topShow: false,
                    iconSrc: ""
                },{
                    title: "时时领",
                    topShow: false,
                    iconSrc: ""
                },{
                    title: "商家入驻",
                    topShow: false,
                    iconSrc: require("../assets/icon/search/settled.png")
                },{
                    title: "商家咨询",
                    topShow: false,
                    iconSrc: require("../assets/icon/search/consult.png")
                },]
            }
        }
    }
</script>

<style scoped lang="less">
    .search {
        margin: 0 auto;
        .top {
            position: relative;
            height: 114px;
            width: 100%;
            .logo {
                width: 222px;
                height: 100%;
                img {
                  position: absolute;
                  bottom: 15px;
                  left: -10px;
                  width: 100px;
                }
                h1 {
                    position: absolute;
                    font-size: 32px;
                    font-weight: bold;
                    color: #151965;
                    width: 100px;
                    bottom: 0;
                    left: 76px;
                }
            }
            .input {
                position: absolute;
                top: 34px;
                left: 245px;
                width: 610px;
                height: 40px;
                form {
                    position: relative;
                    input {
                        position: absolute;
                        left: 0;
                        top: 0;
                        height: 40px;
                        width: 610px;
                        border: 2px solid #151965;
                        border-radius: 20px;
                        padding-left: 20px;
                        color: #666;
                    }
                    button {
                        position: absolute;
                        right: 0;
                        top: 0;
                        width: 80px;
                        height: 40px;
                        color: white;
                        background-color: #151965;
                        border: none;
                        border-radius: 20px;
                    }
                }

            }
        }
        .bottom {
            position: relative;
            height: 34px;
            width: 100%;
            margin-top: 10px;
            margin-bottom: 1px;
            .categories {
                position: absolute;
                top: 0;
                left: 0;
                width: 170px;
                line-height: 34px;
                height: 34px;
                color: #fff;
                background: #333333;
                text-align: center;
                cursor: pointer;
                padding: 0 0 0 14px;

                img {
                    margin-top: -5px;
                    margin-left: 40px;
                }
            }
            .cate_nav {
                position: absolute;
                left: 170px;
                top: 0;
                width: 915px;
                height: 34px;
                line-height: 34px;
                font-weight: bold;
                font-size: 15px;
                color: #333;

                li {
                    float: left;
                    padding: 0 14px;
                    white-space: normal;
                    cursor: pointer;

                    img {
                        display: inline-block;
                        width: 20px;
                        height: 20px;
                        margin-right: 5px;
                    }

                    &:hover {
                        color: deeppink;
                    }
                }
            }
        }
    }
    .fixed {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 2;
        width: 100%;
        height: 50px;
        line-height: 50px;
        background-color: rgba(244,74,151,1);
        color: white;

        .w {
            margin: 0 auto;
            ul {
                margin-bottom: 0;

                li {
                    float: left;
                    padding: 0 20px;

                    &:first-of-type {
                        padding: 0 53px;
                    }

                    &.active {
                        background-color: rgba(255,0,0,.3);
                    }

                    &:hover {
                        cursor: pointer;
                        background-color: rgba(255,0,0,.2);
                    }
                }
            }
        }
    }
    @media screen and (max-width: 1200px) {
        .search {
            width: 100%;
        }
    }
</style>
